package yznu_Bean_handle;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import yznu_jdbc.JDpoor;
//����ɾ������bean
public class Delete {
	Connection con = new JDpoor().CreateCon();
	Statement sql = null;
	PreparedStatement pre = null;
	ResultSet rs = null;
	boolean f = false;
	
	public boolean Del_user(String Username) {
		String condition = "delete from user_info where name=?";
		try {
			pre = con.prepareStatement(condition);
			pre.setString(1, Username);
			int t = pre.executeUpdate();
			if(t!=0)
	    		f = true;
	    	else
	    		f = false;
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.println(e);
			f = false;
		}
		return f;
	}
	

	public boolean Del_order(String Username) {
		// TODO Auto-generated method stub
		String condition = "delete from order_info where user=?";
		try {
			pre = con.prepareStatement(condition);
			pre.setString(1, Username);
			int t = pre.executeUpdate();
			if(t!=0)
	    		f = true;
	    	else
	    		f = false;
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			f = false;
		}
		return f;
	}

	public boolean Del_good(String Username) {
		// TODO Auto-generated method stub
		String condition = "delete from goods_info where name=?";
		try {
			pre = con.prepareStatement(condition);
			pre.setString(1, Username);
			int t = pre.executeUpdate();
			if(t!=0)
	    		f = true;
	    	else
	    		f = false;
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.println(e);
			f = false;
		}
		return f;
	}
	
	public boolean Del_store(String Username) {
		// TODO Auto-generated method stub
		String condition = "delete from otherStore_info where name=?";
		try {
			pre = con.prepareStatement(condition);
			pre.setString(1, Username);
			int t = pre.executeUpdate();
			if(t!=0)
	    		f = true;
	    	else
	    		f = false;
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			System.out.println(e);
			f = false;
		}
		return f;
	}


	public boolean Del_others_order(String username) {
		// TODO Auto-generated method stub
		String condition = "delete from others_order_info where user=?";
		try {
			pre = con.prepareStatement(condition);
			pre.setString(1, username);
			int t = pre.executeUpdate();
			if(t!=0)
	    		f = true;
	    	else
	    		f = false;
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			f = false;
		}
		return f;
	}
	
	public boolean Del_join(String username) {
		// TODO Auto-generated method stub
		String condition = "delete from join_info where name=?";
		try {
			pre = con.prepareStatement(condition);
			pre.setString(1, username);
			int t = pre.executeUpdate();
			if(t!=0)
	    		f = true;
	    	else
	    		f = false;
			
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			f = false;
		}
		return f;
	}
}
